package day04;
import java.util.Scanner;
public class HomeWork {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);


//1CommandBySwitch Switch版
        /*
        System.out.println("请输入你所办理的业务：1.查询余额; 2.存钱; 3.取钱; 4.转账; 5.其他业务 6.取卡");
        int command = sc.nextInt();
        switch (command){
            case 1:
                System.out.println("查询余额");
                break;
            case 2:
                System.out.println("存钱");
                break;
            case 3:
                System.out.println("取钱");
                break;
            case 4:
                System.out.println("转账");
                break;
            case 5:
                System.out.println("其他业务");
                break;
            case 6:
                System.out.println("取卡");
                break;
            default:
                System.out.println("错误");
        }

         */

//Guessing   随机猜数字 while版：方法1：
        /*
        int num =(int) (Math.random()*100+1);
        System.out.println(num);
        System.out.println("猜一个数字");
        int guess =sc.nextInt();
        while (true){
            if (guess>num){
                System.out.println("猜大了");
            }else if (guess<num){
                System.out.println("猜小了");
            }else {
                System.out.println("猜对了");
                break;
            }
            System.out.println("再接再厉");
            guess = sc.nextInt();

        }

         */

//Guessing猜数字 while版：方法2：
   /*
        int num =(int)(Math.random()*1000+1);
        System.out.println(num);

        System.out.println("猜一个数字");
        int guess = sc.nextInt();
        while (guess!=num){
            if (guess>num){
                System.out.println("太大了");
            }else {
                System.out.println("太小了");
            }
            System.out.println("再接再励");
            guess = sc.nextInt();
        }
        System.out.println("恭喜你猜对了");

    */

//guessing 随机猜数字 do...while版：
        /*
        int num =(int)(Math.random()*1000+1);
        System.out.println(num);//生成的随机数字

        int guess;
        do {
            System.out.println("猜一个数字");
            guess = sc.nextInt();
            if (guess>num){
                System.out.println("太大了");
            } else if (guess<num) {
                System.out.println("太小了");
            }else {
                System.out.println("恭喜你答对了");
            }
        }while (guess!=num);

         */


//guessing 随机猜数字 do...while版 2：
      /*

      int num =(int)(Math.random()*1000+1);
        System.out.println(num);//生成的随机数字

        int guess;
        do {
            System.out.println("猜一个数字");
            guess = sc.nextInt();
            if (guess>num){
                System.out.println("太大了");
            } else if (guess<num) {
                System.out.println("太小了");
            }else {
                System.out.println("恭喜你答对了");
                break;
            }
        }while (true);

       */


//for 循环：输出5次行动是成功的阶梯(2种写法)：
     /*   for (int i=0;i<5;i++){
            System.out.println("行动是成功的阶梯");
        }

      */
        /*
        int i=0;
        for (;i<5;){
            System.out.println("行动是成功的阶梯");
            i++;
        }

         */

//for循环： 9的乘法表（1~9；1/3/5/7/9   9~1  1~100的和）
     /*
        for(int i=1;i<=9;i++){
            System.out.println(i+"*9="+i*9);
        }
        System.out.println("-----------");
        for(int i=1;i<=9;i+=2){
            System.out.println(i+"*9="+i*9);
        }
        System.out.println("-----------------");
        for(int i=9;i>=1;i--){
            System.out.println(i+"*9="+i*9);
        }
        System.out.println("-----------");
        int sum =0;
        for(int i=1;i<=100;i++){
            sum +=i;
        }
        System.out.println(sum);

      */


//拓展1。判断他的正负
     /*
        System.out.println("请输入一个整数");
        int num = sc.nextInt();

        if (num>0){
            System.out.println("+");
        }else if (num<0){
            System.out.println("-");
        }else {
            System.out.println("0");
        }

      */

//拓展2.接受用户输入的年份和月份，计算该年的天数
        /*
        System.out.println("请输入年份");
        int year = sc.nextInt();
        System.out.println("请输入月份");
        int month = sc.nextInt();

        int days=0;
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                days=31;
                break;

            case 4:
            case 6:
            case 9:
            case 11:
                days=30;
                break;

            case 2:
                if ((year%4==0 && year%100!=0)||year%400==0){
                    days = 29;
                }else {
                    days = 28;
                }

        }
        System.out.println(year+"年的"+month+"月共"+days+"天");
         */

//输出1900到2023年之间所有的闰年（每够10个年份换一行）
        int count=0;
        for(int year=1900;year<=2023;year++){
            if((year%4==0 && year%400!=0) || year%400==0){
                System.out.print(year+" ");
                count++;
                if(count%5==0){
                    System.out.println();
               }
            }
        }




    }
}
